import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:get/get.dart';
import 'package:x_common_utils/utils/inkWell_util.dart';
import 'package:xinxuan/common/scroll_configuration_common.dart';
import 'package:xinxuan/utils/color_util.dart';

class ActivityRuleDialog extends StatelessWidget {

  final String message;
  ActivityRuleDialog({ required this.message });

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: 320.w,
          height: 559.h,
          decoration: BoxDecoration(
            color: bgWhiteColor,
            borderRadius: BorderRadius.circular(12.w)
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Expanded(child: Container(
                padding: EdgeInsets.symmetric(vertical: 32.h),
                child: Column(
                  children: [
                    Container(
                      margin: EdgeInsets.only(bottom: 22.h),
                      alignment: Alignment.center,
                      child: Text(
                        '活动规则',
                        style: TextStyle(
                          color: textBlackColor,
                          fontSize: 20.sp
                        ),
                      ),
                    ),
                    Expanded(
                      child: Container(
                        padding: EdgeInsets.symmetric(horizontal: 16.w),
                        child: ScrollConfigurationCommon(child: SingleChildScrollView(
                          child: HtmlWidget(
                            message
                          ),
                        )),
                      )
                    ),
                  ],
                ),
              )),
              Container(
                height: 55.h,
                decoration: BoxDecoration(
                  border: Border(
                    top: BorderSide(
                      width: .5,
                      color: lineColor
                    )
                  )
                ),
                child: InkWellUtil.shakeProofInkWell(Container(
                    height: 55.h,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.only(
                        bottomRight: Radius.circular(12.w),
                      )
                    ),
                    child: Text(
                      '确定',
                      style: TextStyle(
                        fontSize: 16.sp,
                        color: mainTextColor
                      ),
                    ),
                  ), () async {
                    Get.back();
                  },
                  hoverColor: Colors.transparent,
                  splashColor: Colors.transparent,
                  highlightColor: Colors.transparent
                ),
              )
            ],
          )
        ),
      ),
    );
  }
}